package com.作业.Day6;

import lombok.Getter;
import lombok.Setter;

import java.util.Scanner;

public class Homework2 {
    public static void main(String[] args) {
        System.out.println("欢迎您来到宠物店");
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要领养宠物的名字:");
        String name = scanner.next();
        System.out.print("请输入要领养的宠物类型:(1.狗狗 2.企鹅)");
        int i = scanner.nextInt();
        if (i == 1) {
            Dog dog = new Dog();
            dog.setName(name);
            System.out.print("请输入狗狗的品种(1.聪明的拉布拉多犬 2.酷酷的雪娜瑞) ");
            int variety = scanner.nextInt();
            if (variety == 1) {
                dog.setStrain("聪明的拉布拉多犬");
            } else
                dog.setStrain("酷酷的雪娜瑞");
            System.out.println(dog);
            dog.print();
        } else {
            Penguin penguin = new Penguin();
            penguin.setName(name);
            System.out.print("请输入企鹅性别:(1.Q妹 2.Q仔)");
            String sex = scanner.next();
            if(sex.equals("1")){
                penguin.setSex("雌");
            }
            else
                penguin.setSex("雄");
            System.out.println(penguin);
             penguin.print();
            }


        }


    }

abstract class  Pet1{
    String name;
    int health=100;
    int love=0;
    void print(){}
}
@Getter
@Setter
class Penguin1 extends Pet1 {
    String sex;

    void print() {
        System.out.println("我的性别" + sex);
    }
}

@Getter
@Setter
class Dog1 extends Pet1 {
    String strain;

    void print() {
        System.out.println("我是一只" + strain);
    }
}